import random

money = 5000
b = 0
c = 1
if c == 1:
    a = random.randint(1, 100)
    print(a)
    while a != b and money != 0:
        print("请输入一个1到100之间的整数:")
        b=int(input())
        if a > b:
            print("猜小了")
            money -= 500
            print("你的余额为",money,"金币")
            if money == 0 :
                print("余额不足，游戏结束")
                break
        elif a < b:
            print("猜大了")
            money -= 500
            print("你的余额为", money, "金币")
            if money == 0 :
                print("余额不足，游戏结束")
                break
        else :
            print("猜对了,获得奖励3000金币")
            money += 3000
            print("你的余额为", money, "金币")
            print("是否继续下一轮游戏，是，请输入1，否，请输入0：")
            c = int(input())
else:
    print("游戏结束！")
    print("你的余额为", money, "金币")




